home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / include / dxva.h < prev    next >
C/C++ Source or Header  |  2001-10-08  |  23KB  |  629 lines

  1. //------------------------------------------------------------------------------
  2. // File: DXVA.h
  3. //
  4. // Desc: DirectX Video Acceleration header file.
  5. //
  6. // Copyright (c) 1999-2001, Microsoft Corporation.  All rights reserved.
  7. //------------------------------------------------------------------------------
  8.  
  9.  
  10. #ifndef __DIRECTX_VA__
  11. #define __DIRECTX_VA__
  12.  
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16.  
  17. DEFINE_GUID(DXVA_ModeNone,    0x1b81be00, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  18. DEFINE_GUID(DXVA_ModeH261_A,  0x1b81be01, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  19. DEFINE_GUID(DXVA_ModeH261_B,  0x1b81be02, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  20. DEFINE_GUID(DXVA_ModeH263_A,  0x1b81be03, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  21. DEFINE_GUID(DXVA_ModeH263_B,  0x1b81be04, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  22. DEFINE_GUID(DXVA_ModeH263_C,  0x1b81be05, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  23. DEFINE_GUID(DXVA_ModeH263_D,  0x1b81be06, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  24. DEFINE_GUID(DXVA_ModeH263_E,  0x1b81be07, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  25. DEFINE_GUID(DXVA_ModeH263_F,  0x1b81be08, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  26. DEFINE_GUID(DXVA_ModeMPEG1_A, 0x1b81be09, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  27. DEFINE_GUID(DXVA_ModeMPEG2_A, 0x1b81be0A, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  28. DEFINE_GUID(DXVA_ModeMPEG2_B, 0x1b81be0B, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  29. DEFINE_GUID(DXVA_ModeMPEG2_C, 0x1b81be0C, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  30. DEFINE_GUID(DXVA_ModeMPEG2_D, 0x1b81be0D, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  31.  
  32. DEFINE_GUID(DXVA_NoEncrypt,   0x1b81beD0, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
  33.  
  34. #define DXVA_RESTRICTED_MODE_UNRESTRICTED        0xFFFF
  35. #define DXVA_RESTRICTED_MODE_H261_A              1
  36. #define DXVA_RESTRICTED_MODE_H261_B              2
  37. #define DXVA_RESTRICTED_MODE_H263_A              3
  38. #define DXVA_RESTRICTED_MODE_H263_B              4
  39. #define DXVA_RESTRICTED_MODE_H263_C              5
  40. #define DXVA_RESTRICTED_MODE_H263_D              6
  41. #define DXVA_RESTRICTED_MODE_H263_E              7
  42. #define DXVA_RESTRICTED_MODE_H263_F              8
  43. #define DXVA_RESTRICTED_MODE_MPEG1_A             9
  44. #define DXVA_RESTRICTED_MODE_MPEG2_A             0xA
  45. #define DXVA_RESTRICTED_MODE_MPEG2_B             0xB
  46. #define DXVA_RESTRICTED_MODE_MPEG2_C             0xC
  47. #define DXVA_RESTRICTED_MODE_MPEG2_D             0xD
  48.  
  49. #define DXVA_COMPBUFFER_TYPE_THAT_IS_NOT_USED    0
  50. #define DXVA_PICTURE_DECODE_BUFFER               1
  51. #define DXVA_MACROBLOCK_CONTROL_BUFFER           2
  52. #define DXVA_RESIDUAL_DIFFERENCE_BUFFER          3
  53. #define DXVA_DEBLOCKING_CONTROL_BUFFER           4
  54. #define DXVA_INVERSE_QUANTIZATION_MATRIX_BUFFER  5
  55. #define DXVA_SLICE_CONTROL_BUFFER                6
  56. #define DXVA_BITSTREAM_DATA_BUFFER               7
  57. #define DXVA_AYUV_BUFFER                         8
  58. #define DXVA_IA44_SURFACE_BUFFER                 9
  59. #define DXVA_DPXD_SURFACE_BUFFER                10
  60. #define DXVA_HIGHLIGHT_BUFFER                   11
  61. #define DXVA_DCCMD_SURFACE_BUFFER               12
  62. #define DXVA_ALPHA_BLEND_COMBINATION_BUFFER     13
  63. #define DXVA_PICTURE_RESAMPLE_BUFFER            14
  64. #define DXVA_READ_BACK_BUFFER                   15
  65.  
  66. #define DXVA_NUM_TYPES_COMP_BUFFERS             16
  67.  
  68. /* values for bDXVA_Func */
  69. #define DXVA_PICTURE_DECODING_FUNCTION        1
  70. #define DXVA_ALPHA_BLEND_DATA_LOAD_FUNCTION   2
  71. #define DXVA_ALPHA_BLEND_COMBINATION_FUNCTION 3
  72. #define DXVA_PICTURE_RESAMPLE_FUNCTION        4
  73.  
  74. /* values returned from Execute command in absence of read-back */
  75. #define DXVA_EXECUTE_RETURN_OK                  0
  76. #define DXVA_EXECUTE_RETURN_DATA_ERROR_MINOR    1
  77. #define DXVA_EXECUTE_RETURN_DATA_ERROR_SIGNIF   2
  78. #define DXVA_EXECUTE_RETURN_DATA_ERROR_SEVERE   3
  79. #define DXVA_EXECUTE_RETURN_OTHER_ERROR_SEVERE  4
  80.  
  81.  
  82. #pragma pack(push, BeforeDXVApacking, 1)
  83.  
  84.  
  85. typedef struct _DXVA_ConnectMode {
  86.   GUID guidMode;
  87.   WORD wRestrictedMode;
  88. } DXVA_ConnectMode, *LPDXVA_ConnectMode;
  89.  
  90.  
  91. typedef DWORD DXVA_ConfigQueryOrReplyFunc, *LPDXVA_ConfigQueryOrReplyFunc;
  92.  
  93. #define DXVA_QUERYORREPLYFUNCFLAG_DECODER_PROBE_QUERY     0xFFFFF1
  94. #define DXVA_QUERYORREPLYFUNCFLAG_DECODER_LOCK_QUERY      0xFFFFF5
  95. #define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_OK_COPY     0xFFFFF8
  96. #define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_OK_PLUS     0xFFFFF9
  97. #define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_LOCK_OK_COPY      0xFFFFFC
  98. #define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_FALSE_PLUS  0xFFFFFB
  99. #define DXVA_QUERYORREPLYFUNCFLAG_ACCEL_LOCK_FALSE_PLUS   0xFFFFFF
  100.  
  101. #define readDXVA_QueryOrReplyFuncFlag(ptr)        ((*(ptr)) >> 8)
  102.  
  103. #define readDXVA_QueryOrReplyFuncFlag_ACCEL(ptr)  (((*(ptr)) >> 11) & 1)
  104. #define readDXVA_QueryOrReplyFuncFlag_LOCK(ptr)   (((*(ptr)) >> 10) & 1)
  105. #define readDXVA_QueryOrReplyFuncFlag_BAD(ptr)    (((*(ptr)) >>  9) & 1)
  106. #define readDXVA_QueryOrReplyFuncFlag_PLUS(ptr)   (((*(ptr)) >>  8) & 1)
  107.  
  108. #define readDXVA_QueryOrReplyFuncFunc(ptr)        ((*(ptr)) & 0xFF)
  109.  
  110. #define writeDXVA_QueryOrReplyFunc(ptr, flg, fnc) ((*(ptr)) = ((flg) << 8) | (fnc))
  111.  
  112. #define setDXVA_QueryOrReplyFuncFlag(ptr, flg) ((*(ptr)) |= ((flg) << 8))
  113. #define setDXVA_QueryOrReplyFuncFunc(ptr, fnc) ((*(ptr)) |= (fnc));
  114.  
  115. typedef DWORD DXVA_EncryptProtocolFunc, *LPDXVA_EncryptProtocolFunc;
  116.  
  117. #define DXVA_ENCRYPTPROTOCOLFUNCFLAG_HOST    0xFFFF00
  118. #define DXVA_ENCRYPTPROTOCOLFUNCFLAG_ACCEL   0xFFFF08
  119.  
  120. #define readDXVA_EncryptProtocolFuncFlag(ptr)        ((*(ptr)) >> 8)
  121. #define readDXVA_EncryptProtocolFuncFlag_ACCEL(ptr)  (((*(ptr)) >> 11) & 1)
  122.  
  123. #define readDXVA_EncryptProtocolFuncFunc(ptr)        ((*(ptr)) & 0xFF)
  124.  
  125. #define writeDXVA_EncryptProtocolFunc(ptr, flg, fnc) ((*(ptr)) = ((flg) << 8) | (fnc))
  126.  
  127. #define setDXVA_EncryptProtocolFuncFlag(ptr, flg) ((*(ptr)) |= ((flg) << 8))
  128. #define setDXVA_EncryptProtocolFuncFunc(ptr, fnc) ((*(ptr)) |= (fnc));
  129.  
  130. typedef struct _DXVA_EncryptProtocolHeader {
  131.   DXVA_EncryptProtocolFunc dwFunction;
  132.   DWORD ReservedBits[3];
  133.   GUID  guidEncryptProtocol;
  134. } DXVA_EncryptProtocolHeader, *LPDXVA_EncryptProtocolHeader;
  135.  
  136. typedef struct _DXVA_ConfigPictureDecode {
  137.  
  138.   // Operation Indicated
  139.   DXVA_ConfigQueryOrReplyFunc dwFunction;
  140.  
  141.   // Alignment
  142.   DWORD dwReservedBits[3];
  143.  
  144.   // Encryption GUIDs
  145.   GUID guidConfigBitstreamEncryption;
  146.   GUID guidConfigMBcontrolEncryption;
  147.   GUID guidConfigResidDiffEncryption;
  148.  
  149.   // Bitstream Processing Indicator
  150.   BYTE bConfigBitstreamRaw;
  151.  
  152.   // Macroblock Control Config
  153.   BYTE bConfigMBcontrolRasterOrder;
  154.  
  155.   // Host Resid Diff Config
  156.   BYTE bConfigResidDiffHost;
  157.   BYTE bConfigSpatialResid8;
  158.   BYTE bConfigResid8Subtraction;
  159.   BYTE bConfigSpatialHost8or9Clipping;
  160.   BYTE bConfigSpatialResidInterleaved;
  161.   BYTE bConfigIntraResidUnsigned;
  162.  
  163.   // Accelerator Resid Diff Config
  164.   BYTE bConfigResidDiffAccelerator;
  165.   BYTE bConfigHostInverseScan;
  166.   BYTE bConfigSpecificIDCT;
  167.   BYTE bConfig4GroupedCoefs;
  168. } DXVA_ConfigPictureDecode, *LPDXVA_ConfigPictureDecode;
  169.  
  170.  
  171. /* Picture Decoding Parameters */
  172.  
  173. typedef struct _DXVA_PictureParameters {
  174.  
  175.   WORD wDecodedPictureIndex;
  176.   WORD wDeblockedPictureIndex;
  177.  
  178.   WORD wForwardRefPictureIndex;
  179.   WORD wBackwardRefPictureIndex;
  180.  
  181.   WORD wPicWidthInMBminus1;
  182.   WORD wPicHeightInMBminus1;
  183.  
  184.   BYTE bMacroblockWidthMinus1;
  185.   BYTE bMacroblockHeightMinus1;
  186.  
  187.   BYTE bBlockWidthMinus1;
  188.   BYTE bBlockHeightMinus1;
  189.  
  190.   BYTE bBPPminus1;
  191.  
  192.   BYTE bPicStructure;
  193.   BYTE bSecondField;
  194.   BYTE bPicIntra;
  195.   BYTE bPicBackwardPrediction;
  196.  
  197.   BYTE bBidirectionalAveragingMode;
  198.   BYTE bMVprecisionAndChromaRelation;
  199.   BYTE bChromaFormat;
  200.  
  201.   BYTE bPicScanFixed;
  202.   BYTE bPicScanMethod;
  203.   BYTE bPicReadbackRequests;
  204.  
  205.   BYTE bRcontrol;
  206.   BYTE bPicSpatialResid8;
  207.   BYTE bPicOverflowBlocks;
  208.   BYTE bPicExtrapolation;
  209.  
  210.   BYTE bPicDeblocked;
  211.   BYTE bPicDeblockConfined;
  212.   BYTE bPic4MVallowed;
  213.   BYTE bPicOBMC;
  214.   BYTE bPicBinPB;
  215.   BYTE bMV_RPS;
  216.  
  217.   BYTE bReservedBits;
  218.  
  219.   WORD wBitstreamFcodes;
  220.   WORD wBitstreamPCEelements;
  221.   BYTE bBitstreamConcealmentNeed;
  222.   BYTE bBitstreamConcealmentMethod;
  223.  
  224. } DXVA_PictureParameters, *LPDXVA_PictureParameters;
  225.  
  226.  
  227. /* Picture Resampling */
  228.  
  229. typedef struct _DXVA_PicResample {
  230.  
  231.   WORD  wPicResampleSourcePicIndex;
  232.   WORD  wPicResampleDestPicIndex;
  233.  
  234.   WORD  wPicResampleRcontrol;
  235.   BYTE  bPicResampleExtrapWidth;
  236.   BYTE  bPicResampleExtrapHeight;
  237.  
  238.   DWORD dwPicResampleSourceWidth;
  239.   DWORD dwPicResampleSourceHeight;
  240.  
  241.   DWORD dwPicResampleDestWidth;
  242.   DWORD dwPicResampleDestHeight;
  243.  
  244.   DWORD dwPicResampleFullDestWidth;
  245.   DWORD dwPicResampleFullDestHeight;
  246.  
  247. } DXVA_PicResample, *LPDXVA_PicResample;
  248.  
  249.  
  250. #define DXVA_CHROMA_FORMAT_420 1
  251. #define DXVA_CHROMA_FORMAT_422 2
  252. #define DXVA_CHROMA_FORMAT_444 3
  253.  
  254. #define DXVA_PICTURE_STRUCTURE_TOP_FIELD    1
  255. #define DXVA_PICTURE_STRUCTURE_BOTTOM_FIELD 2
  256. #define DXVA_PICTURE_STRUCTURE_FRAME        3
  257.  
  258. #define DXVA_BIDIRECTIONAL_AVERAGING_MPEG2_ROUND 0
  259. #define DXVA_BIDIRECTIONAL_AVERAGING_H263_TRUNC  1
  260.  
  261. #define DXVA_MV_PRECISION_AND_CHROMA_RELATION_MPEG2  0
  262. #define DXVA_MV_PRECISION_AND_CHROMA_RELATION_H263   1
  263. #define DXVA_MV_PRECISION_AND_CHROMA_RELATION_H261   2
  264.  
  265. #define DXVA_SCAN_METHOD_ZIG_ZAG              0
  266. #define DXVA_SCAN_METHOD_ALTERNATE_VERTICAL   1
  267. #define DXVA_SCAN_METHOD_ALTERNATE_HORIZONTAL 2
  268. #define DXVA_SCAN_METHOD_ARBITRARY            3
  269.  
  270. #define DXVA_BITSTREAM_CONCEALMENT_NEED_UNLIKELY 0
  271. #define DXVA_BITSTREAM_CONCEALMENT_NEED_MILD     1
  272. #define DXVA_BITSTREAM_CONCEALMENT_NEED_LIKELY   2
  273. #define DXVA_BITSTREAM_CONCEALMENT_NEED_SEVERE   3
  274.  
  275. #define DXVA_BITSTREAM_CONCEALMENT_METHOD_UNSPECIFIED 0
  276. #define DXVA_BITSTREAM_CONCEALMENT_METHOD_INTRA       1
  277. #define DXVA_BITSTREAM_CONCEALMENT_METHOD_FORWARD     2
  278. #define DXVA_BITSTREAM_CONCEALMENT_METHOD_BACKWARD    3
  279.  
  280.  
  281. /* Buffer Description Data */
  282.  
  283. typedef struct _DXVA_BufferDescription {
  284.   DWORD dwTypeIndex;
  285.   DWORD dwBufferIndex;
  286.   DWORD dwDataOffset;
  287.   DWORD dwDataSize;
  288.   DWORD dwFirstMBaddress;
  289.   DWORD dwNumMBsInBuffer;
  290.   DWORD dwWidth;
  291.   DWORD dwHeight;
  292.   DWORD dwStride;
  293.   DWORD dwReservedBits;
  294. } DXVA_BufferDescription, *LPDXVA_BufferDescription;
  295.  
  296.  
  297. /* Off-Host IDCT Coefficient Data Structures */
  298.  
  299. typedef struct _DXVA_TCoef4Group {
  300.   BYTE  TCoefIDX[4];
  301.   SHORT TCoefValue[4];
  302. } DXVA_TCoef4Group, *LPDXVA_TCoef4Group;
  303.  
  304. typedef struct _DXVA_TCoefSingle {
  305.   WORD  wIndexWithEOB;
  306.   SHORT TCoefValue;
  307. } DXVA_TCoefSingle, *LPDXVA_TCoefSingle;
  308.  
  309. /* Macros for Reading EOB and Index Values */
  310.  
  311. #define readDXVA_TCoefSingleIDX(ptr) ((ptr)->wIndexWithEOB >> 1)
  312. #define readDXVA_TCoefSingleEOB(ptr) ((ptr)->wIndexWithEOB & 1)
  313.  
  314. /* Macro for Writing EOB and Index Values */
  315.  
  316. #define writeDXVA_TCoefSingleIndexWithEOB(ptr, idx, eob) ((ptr)->wIndexWithEOB = ((idx) << 1) | (eob))
  317. #define setDXVA_TCoefSingleIDX(ptr, idx) ((ptr)->wIndexWithEOB |= ((idx) << 1))
  318. #define setDXVA_TCoefSingleEOB(ptr)      ((ptr)->wIndexWithEOB |= 1)
  319.  
  320. /* Spatial-Domain Residual Difference Blocks */
  321.  
  322. #define DXVA_USUAL_BLOCK_WIDTH   8
  323. #define DXVA_USUAL_BLOCK_HEIGHT  8
  324. #define DXVA_USUAL_BLOCK_SIZE   (DXVA_USUAL_BLOCK_WIDTH * DXVA_USUAL_BLOCK_HEIGHT)
  325.  
  326. typedef SHORT       DXVA_Sample16[DXVA_USUAL_BLOCK_SIZE];
  327. typedef signed char DXVA_Sample8 [DXVA_USUAL_BLOCK_SIZE];
  328.  
  329. /* Deblocking Filter Control Structure */
  330.  
  331. typedef BYTE DXVA_DeblockingEdgeControl;
  332.  
  333. typedef DXVA_DeblockingEdgeControl * LPDXVA_DeblockingEdgeControl;
  334.  
  335. /* Macros for Reading STRENGTH and FilterOn */
  336.  
  337. #define readDXVA_EdgeFilterStrength(ptr) ((*(ptr)) >> 1)
  338. #define readDXVA_EdgeFilterOn(ptr)       ((*(ptr)) & 1)
  339.  
  340. /* Macro for Writing STRENGTH and FilterOn */
  341.  
  342. #define writeDXVA_DeblockingEdgeControl(ptr, str, fon) ((*(ptr)) = ((str) << 1) | (fon))
  343. #define setDXVA_EdgeFilterStrength(ptr, str)           ((*(ptr)) |= ((str) << 1))
  344. #define setDXVA_EdgeFilterOn(ptr)                      ((*(ptr)) |= 1)
  345.  
  346.  
  347. /* Macroblock Control Command Data Structures */
  348.  
  349. typedef struct _DXVA_MVvalue {
  350.   SHORT horz, vert;
  351. } DXVA_MVvalue, *LPDXVA_MVvalue;
  352.  
  353.  
  354. /* Inverse Quantization Matrices */
  355.  
  356. typedef struct _DXVA_QmatrixData {
  357.   BYTE bNewQmatrix[4]; /* intra Y, inter Y, intra chroma, inter chroma */
  358.   WORD Qmatrix[4][DXVA_USUAL_BLOCK_WIDTH * DXVA_USUAL_BLOCK_HEIGHT];
  359. } DXVA_QmatrixData, *LPDXVA_QmatrixData;
  360.  
  361.  
  362. /* Slice Control Buffer Data */
  363.  
  364. typedef struct _DXVA_SliceInfo {
  365.   WORD  wHorizontalPosition;
  366.   WORD  wVerticalPosition;
  367.   DWORD dwSliceBitsInBuffer;
  368.   DWORD dwSliceDataLocation;
  369.   BYTE  bStartCodeBitOffset;
  370.   BYTE  bReservedBits;
  371.   WORD  wMBbitOffset;
  372.   WORD  wNumberMBsInSlice;
  373.   WORD  wQuantizerScaleCode;
  374.   WORD  wBadSliceChopping;
  375. } DXVA_SliceInfo, *LPDXVA_SliceInfo;
  376.  
  377.  
  378. #define DXVA_NumMV_OBMC_off_BinPBwith4MV_off    4
  379. #define DXVA_NumMV_OBMC_off_BinPBwith4MV_on  (4+1)
  380. #define DXVA_NumMV_OBMC_on__BinPB_off         (10)
  381. #define DXVA_NumMV_OBMC_on__BinPB_on          (11) /* not current standards */
  382.  
  383. #define DXVA_NumBlocksPerMB_420 (4+2+0)
  384. #define DXVA_NumBlocksPerMB_422 (4+2+2)
  385. #define DXVA_NumBlocksPerMB_444 (4+4+4)
  386.  
  387. /* Basic form for I pictures */
  388. /* Host Residual Differences */
  389. typedef struct _DXVA_MBctrl_I_HostResidDiff_1 {
  390.   WORD  wMBaddress;
  391.   WORD  wMBtype;
  392.   DWORD dwMB_SNL;
  393.   WORD  wPatternCode;
  394.   WORD  wPC_Overflow; /* zero if not overflow format */
  395.   DWORD dwReservedBits2;
  396. } DXVA_MBctrl_I_HostResidDiff_1;
  397.  
  398. /* Basic form for I pictures */
  399. /* Off-Host IDCT, 4:2:0 sampling */
  400. typedef struct _DXVA_MBctrl_I_OffHostIDCT_1 {
  401.   WORD  wMBaddress;
  402.   WORD  wMBtype;
  403.   DWORD dwMB_SNL;
  404.   WORD  wPatternCode;
  405.   BYTE  bNumCoef[DXVA_NumBlocksPerMB_420];
  406. } DXVA_MBctrl_I_OffHostIDCT_1;
  407.  
  408. /* Basic form for P and B pictures */
  409. /* Should also be used for concealment MVs in MPEG-2 I pictures */
  410. /* Without OBMC, without BinPB and 4MV together, without MV RPS */
  411. /* Host Residual Differences */
  412. typedef struct _DXVA_MBctrl_P_HostResidDiff_1 {
  413.   WORD         wMBaddress;
  414.   WORD         wMBtype;
  415.   DWORD        dwMB_SNL;
  416.   WORD         wPatternCode;
  417.   WORD         wPC_Overflow; /* zero if not overflow format */
  418.   DWORD        dwReservedBits2;
  419.   DXVA_MVvalue MVector[DXVA_NumMV_OBMC_off_BinPBwith4MV_off];
  420. } DXVA_MBctrl_P_HostResidDiff_1;
  421.  
  422. /* Basic form for P and B pictures */
  423. /* Without OBMC, without BinPB and 4MV together, without MV RPS */
  424. /* Off-Host IDCT, 4:2:0 sampling */
  425. typedef struct _DXVA_MBctrl_P_OffHostIDCT_1 {
  426.   WORD         wMBaddress;
  427.   WORD         wMBtype;
  428.   DWORD        dwMB_SNL;
  429.   WORD         wPatternCode;
  430.   BYTE         bNumCoef[DXVA_NumBlocksPerMB_420];
  431.   DXVA_MVvalue MVector[DXVA_NumMV_OBMC_off_BinPBwith4MV_off];
  432. } DXVA_MBctrl_P_OffHostIDCT_1;
  433.  
  434. /* How to load alpha blending graphic data */
  435. typedef struct _DXVA_ConfigAlphaLoad {
  436.  
  437.   // Operation Indicated
  438.   DXVA_ConfigQueryOrReplyFunc dwFunction;
  439.  
  440.   // Alignment
  441.   DWORD dwReservedBits[3];
  442.  
  443.   BYTE  bConfigDataType;
  444. } DXVA_ConfigAlphaLoad, *LPDXVA_ConfigAlphaLoad;
  445.  
  446. #define DXVA_CONFIG_DATA_TYPE_IA44  0
  447. #define DXVA_CONFIG_DATA_TYPE_AI44  1
  448. #define DXVA_CONFIG_DATA_TYPE_DPXD  2
  449. #define DXVA_CONFIG_DATA_TYPE_AYUV  3
  450.  
  451.  
  452. /* How to combine alpha blending graphic data */
  453. typedef struct _DXVA_ConfigAlphaCombine {
  454.  
  455.   // Operation Indicated
  456.   DXVA_ConfigQueryOrReplyFunc dwFunction;
  457.  
  458.   // Alignment
  459.   DWORD dwReservedBits[3];
  460.  
  461.   BYTE  bConfigBlendType;
  462.   BYTE  bConfigPictureResizing;
  463.   BYTE  bConfigOnlyUsePicDestRectArea;
  464.   BYTE  bConfigGraphicResizing;
  465.   BYTE  bConfigWholePlaneAlpha;
  466.  
  467. } DXVA_ConfigAlphaCombine, *LPDXVA_ConfigAlphaCombine;
  468.  
  469. #define DXVA_CONFIG_BLEND_TYPE_FRONT_BUFFER   0
  470. #define DXVA_CONFIG_BLEND_TYPE_BACK_HARDWARE  1
  471.  
  472.  
  473. /* AYUV sample for 16-entry YUV palette or graphic surface */
  474.  
  475. typedef struct _DXVA_AYUVsample2 {
  476.   BYTE bCrValue;
  477.   BYTE bCbValue;
  478.   BYTE bY_Value;
  479.   BYTE bSampleAlpha8;
  480. } DXVA_AYUVsample2, *LPDXVA_AYUVsample2;
  481.  
  482. /* Macros for IA44 alpha blending surface samples */
  483.  
  484. typedef BYTE DXVA_IA44sample, *LPDXVA_IA44sample;
  485.  
  486. #define readDXVA_IA44index(ptr) (((*(ptr)) & 0xF0) >> 4)
  487. #define readDXVA_IA44alpha(ptr)  ((*(ptr)) & 0x0F)
  488.  
  489. #define writeDXVA_IA44(ptr, idx, alpha) ((*(ptr)) = (((idx) << 4) | (alpha)))
  490.  
  491. #define setDXVA_IA44index(ptr, idx)    ((*(ptr)) |= ((idx) << 4))
  492. #define setDXVA_IA44alpha(ptr, alpha)  ((*(ptr)) |= (alpha))
  493.  
  494. /* Macros for AI44 alpha blending surface samples */
  495.  
  496. typedef BYTE DXVA_AI44sample, *LPDXVA_AI44sample;
  497.  
  498. #define readDXVA_AI44index(ptr)  ((*(ptr)) & 0x0F)
  499. #define readDXVA_AI44alpha(ptr) (((*(ptr)) & 0xF0) >> 4)
  500.  
  501. #define writeDXVA_AI44(ptr, idx, alpha) ((*(ptr)) = (((alpha) << 4) | (idx)))
  502.  
  503. #define setDXVA_AI44index(ptr, idx)    ((*(ptr)) |= (idx))
  504. #define setDXVA_AI44alpha(ptr, alpha)  ((*(ptr)) |= ((alpha) << 4))
  505.  
  506.  
  507. /* Highlight data structure */
  508.  
  509. typedef struct _DXVA_Highlight {
  510.   WORD wHighlightActive;
  511.   WORD wHighlightIndices;
  512.   WORD wHighlightAlphas;
  513.   RECT HighlightRect;
  514. } DXVA_Highlight, *LPDXVA_Highlight;
  515.  
  516. typedef BYTE DXVA_DPXD,  *LPDXVA_DPXD;
  517. typedef WORD DXVA_DCCMD, *LPDXVA_DCCMD;
  518.  
  519. /* Alpha blend combination */
  520.  
  521. typedef struct _DXVA_BlendCombination {
  522.   WORD wPictureSourceIndex;
  523.   WORD wBlendedDestinationIndex;
  524.   RECT PictureSourceRect16thPel;
  525.   RECT PictureDestinationRect;
  526.   RECT GraphicSourceRect;
  527.   RECT GraphicDestinationRect;
  528.   WORD wBlendDelay;
  529.   BYTE bBlendOn;
  530.   BYTE bWholePlaneAlpha;
  531.   DXVA_AYUVsample2 OutsideYUVcolor;
  532. } DXVA_BlendCombination, *LPDXVA_BlendCombination;
  533.  
  534.  
  535. #pragma pack(push, 16)
  536.  
  537.  
  538. typedef DXVA_MBctrl_I_HostResidDiff_1 *
  539.        LPDXVA_MBctrl_I_HostResidDiff_1;
  540.  
  541. typedef DXVA_MBctrl_I_OffHostIDCT_1 *
  542.        LPDXVA_MBctrl_I_OffHostIDCT_1;
  543.  
  544. typedef DXVA_MBctrl_P_HostResidDiff_1 *
  545.        LPDXVA_MBctrl_P_HostResidDiff_1;
  546.  
  547. typedef DXVA_MBctrl_P_OffHostIDCT_1 *
  548.        LPDXVA_MBctrl_P_OffHostIDCT_1;
  549.  
  550.  
  551. #pragma pack(pop)
  552.  
  553. /*
  554.  * Other forms of pictures are constructed in the obvious way
  555.  * from the above by adjusting the number of residual difference
  556.  * blocks, the number of motion vectors per macroblock, etc.
  557.  */
  558.  
  559. #define readDXVA_MBskipsFollowing(ptr)       (((ptr)->dwMB_SNL & 0xFF000000) >> 24)
  560. #define readDXVA_MBdataLocation(ptr)         (((ptr)->dwMB_SNL & 0x00FFFFFF))
  561.  
  562. #define writeDXVA_MB_SNL(ptr, skips, dloc)   ((ptr)->dwMB_SNL = (((skips) << 24) | (dloc)))
  563. #define setDXVA_MBskipsFollowing(ptr, skips) ((ptr)->dwMB_SNL |= ((skips) << 24))
  564. #define setDXVA_MBdataLocation(ptr, dloc)    ((ptr)->dwMB_SNL |= (dloc))
  565.  
  566. #define readDXVA_MvertFieldSel_3(ptr)    (((ptr)->wMBtype & 0x8000) >> 15)
  567. #define readDXVA_MvertFieldSel_2(ptr)    (((ptr)->wMBtype & 0x4000) >> 14)
  568. #define readDXVA_MvertFieldSel_1(ptr)    (((ptr)->wMBtype & 0x2000) >> 13)
  569. #define readDXVA_MvertFieldSel_0(ptr)    (((ptr)->wMBtype & 0x1000) >> 12)
  570. #define readDXVA_ReservedBits(ptr)       (((ptr)->wMBtype & 0x0800) >> 11)
  571. #define readDXVA_HostResidDiff(ptr)      (((ptr)->wMBtype & 0x0400) >> 10)
  572. #define readDXVA_MotionType(ptr)         (((ptr)->wMBtype & 0x0300) >>  8)
  573. #define readDXVA_MBscanMethod(ptr)       (((ptr)->wMBtype & 0x00C0) >>  6)
  574. #define readDXVA_FieldResidual(ptr)      (((ptr)->wMBtype & 0x0020) >>  5)
  575. #define readDXVA_H261LoopFilter(ptr)     (((ptr)->wMBtype & 0x0010) >>  4)
  576. #define readDXVA_Motion4MV(ptr)          (((ptr)->wMBtype & 0x0008) >>  3)
  577. #define readDXVA_MotionBackward(ptr)     (((ptr)->wMBtype & 0x0004) >>  2)
  578. #define readDXVA_MotionForward(ptr)      (((ptr)->wMBtype & 0x0002) >>  1)
  579. #define readDXVA_IntraMacroblock(ptr)    (((ptr)->wMBtype & 0x0001))
  580.  
  581. #define setDXVA_MvertFieldSel_3(ptr)     ((ptr)->wMBtype |= 0x8000)
  582. #define setDXVA_MvertFieldSel_2(ptr)     ((ptr)->wMBtype |= 0x4000)
  583. #define setDXVA_MvertFieldSel_1(ptr)     ((ptr)->wMBtype |= 0x2000)
  584. #define setDXVA_MvertFieldSel_0(ptr)     ((ptr)->wMBtype |= 0x1000)
  585. #define setDXVA_ReservedBits(ptr)        ((ptr)->wMBtype |= 0x0800)
  586. #define setDXVA_HostResidDiff(ptr)       ((ptr)->wMBtype |= 0x0400)
  587. #define setDXVA_MotionType(ptr, value)   ((ptr)->wMBtype |= ((value) << 8))
  588. #define setDXVA_MBscanMethod(ptr, value) ((ptr)->wMBtype |= ((value) << 6))
  589. #define setDXVA_FieldResidual(ptr)       ((ptr)->wMBtype |= 0x0020)
  590. #define setDXVA_H261LoopFilter(ptr)      ((ptr)->wMBtype |= 0x0010)
  591. #define setDXVA_Motion4MV(ptr)           ((ptr)->wMBtype |= 0x0008)
  592. #define setDXVA_MotionBackward(ptr)      ((ptr)->wMBtype |= 0x0004)
  593. #define setDXVA_MotionForward(ptr)       ((ptr)->wMBtype |= 0x0002)
  594. #define setDXVA_IntraMacroblock(ptr)     ((ptr)->wMBtype |= 0x0001)
  595.  
  596. #define readDXVA_Y___0coded(ptr)        (((ptr)->wPatternCode & 0x0800) >> 11)
  597. #define readDXVA_Y___1coded(ptr)        (((ptr)->wPatternCode & 0x0400) >> 10)
  598. #define readDXVA_Y___2coded(ptr)        (((ptr)->wPatternCode & 0x0200) >>  9)
  599. #define readDXVA_Y___3coded(ptr)        (((ptr)->wPatternCode & 0x0100) >>  8)
  600. #define readDXVA_Cb__4coded(ptr)        (((ptr)->wPatternCode & 0x0080) >>  7)
  601. #define readDXVA_Cr__5coded(ptr)        (((ptr)->wPatternCode & 0x0040) >>  6)
  602. #define readDXVA_Cb__6coded(ptr)        (((ptr)->wPatternCode & 0x0020) >>  5)
  603. #define readDXVA_Cr__7coded(ptr)        (((ptr)->wPatternCode & 0x0010) >>  4)
  604. #define readDXVA_Cb__8coded(ptr)        (((ptr)->wPatternCode & 0x0008) >>  3)
  605. #define readDXVA_Cb__9coded(ptr)        (((ptr)->wPatternCode & 0x0004) >>  2)
  606. #define readDXVA_Cr_10coded(ptr)        (((ptr)->wPatternCode & 0x0002) >>  1)
  607. #define readDXVA_Cr_11coded(ptr)        (((ptr)->wPatternCode & 0x0001))
  608.  
  609. #define readDXVA_Y___0oflow(ptr)        (((ptr)->wPC_Overflow & 0x0800) >> 11)
  610. #define readDXVA_Y___1oflow(ptr)        (((ptr)->wPC_Overflow & 0x0400) >> 10)
  611. #define readDXVA_Y___2oflow(ptr)        (((ptr)->wPC_Overflow & 0x0200) >>  9)
  612. #define readDXVA_Y___3oflow(ptr)        (((ptr)->wPC_Overflow & 0x0100) >>  8)
  613. #define readDXVA_Cb__4oflow(ptr)        (((ptr)->wPC_Overflow & 0x0080) >>  7)
  614. #define readDXVA_Cr__5oflow(ptr)        (((ptr)->wPC_Overflow & 0x0040) >>  6)
  615. #define readDXVA_Cb__6oflow(ptr)        (((ptr)->wPC_Overflow & 0x0020) >>  5)
  616. #define readDXVA_Cr__7oflow(ptr)        (((ptr)->wPC_Overflow & 0x0010) >>  4)
  617. #define readDXVA_Cb__8oflow(ptr)        (((ptr)->wPC_Overflow & 0x0008) >>  3)
  618. #define readDXVA_Cb__9oflow(ptr)        (((ptr)->wPC_Overflow & 0x0004) >>  2)
  619. #define readDXVA_Cr_10oflow(ptr)        (((ptr)->wPC_Overflow & 0x0002) >>  1)
  620. #define readDXVA_Cr_11oflow(ptr)        (((ptr)->wPC_Overflow & 0x0001))
  621.  
  622. #pragma pack(pop, BeforeDXVApacking)
  623.  
  624. #ifdef __cplusplus
  625. }
  626. #endif
  627.  
  628. #endif /* __DIRECTX_VA__ */
  629.